UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yEWCf8OV0aRzzq+ERZ9moikLkIHZxmW+j4194psZcjI='
WHERE
key_id = 'fb52dcd42ea7db9806053ae69b843cd5478e8005ce18cd4bd3f8b810692b56af'
AND (
token = 'yEWCf8OV0aRzzq+ERZ9moikLkIHZxmW+j4194psZcjI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)