UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NgikAr4oiH0C1gdwDPDzEuXzEayB6FUCYsD3fkYeJEU='
WHERE
key_id = '1462793795de08b6b37e3391cc7a62c1e39cd43941b193a7f11771f1cb6b5870'
AND (
token = 'NgikAr4oiH0C1gdwDPDzEuXzEayB6FUCYsD3fkYeJEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)