UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jj0nMczczID+KbN8ZNjLpqVVB7sWo/j+nmaf38+5iUg='
WHERE
key_id = 'b94502293ac47b72a67ba6d8601ba2bbd0ac540919070b068b53323923192687'
AND (
token = 'Jj0nMczczID+KbN8ZNjLpqVVB7sWo/j+nmaf38+5iUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)