UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tuRTU7C8w7+N6YbqzxEnVjWVCLwjQ9FnGdkh4iPPg78='
WHERE
key_id = '4ad2a61149dc53c0f914a9d18ae56b37506d2a254bc10205849fd689cb3cb952'
AND (
token = 'tuRTU7C8w7+N6YbqzxEnVjWVCLwjQ9FnGdkh4iPPg78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)