UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E1ZqL/qKOQujMbN22Sv8G4agBcxFWoRYaluMVQ5gxYU='
WHERE
key_id = 'b8b74a74dd4491afe56bed35c40c8610f2d66910f85a5569d5829a3b5077fccf'
AND (
token = 'E1ZqL/qKOQujMbN22Sv8G4agBcxFWoRYaluMVQ5gxYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)