UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xaM3lNFBsGiP9LSzatmMpV0dDC61NPuqKVAWgPnbb+I='
WHERE
key_id = 'edfeac009d0db4231548aa5e49234b27d5b8f20cbfcd501f708ba1acc1a94502'
AND (
token = 'xaM3lNFBsGiP9LSzatmMpV0dDC61NPuqKVAWgPnbb+I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)