UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gSIMj8XUE+u+rYCZf8kyl3sg3T0Zy+/Uhzrg6Dq2F5o='
WHERE
key_id = '031432a56af9694f62c7fc191e2ecd806f61ce44877ed150d43621213ba05b40'
AND (
token = 'gSIMj8XUE+u+rYCZf8kyl3sg3T0Zy+/Uhzrg6Dq2F5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)