UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J57TRi+ygCeUveS98hDURig1wcFGkK2wpcOdIFV914o='
WHERE
key_id = 'c396285a9cde38422aa2877a891d314332f07aeff1d850aad1fc8260049dda5e'
AND (
token = 'J57TRi+ygCeUveS98hDURig1wcFGkK2wpcOdIFV914o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)