UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bAJpepgzZwpB+uxT1WkOBXKoxxO/PUei/6mfgSqVQMo='
WHERE
key_id = 'a99abae46655337fbe9a7dd3fa41f862b2d1285e0c0da5133fc4dbe3fe93c13e'
AND (
token = 'bAJpepgzZwpB+uxT1WkOBXKoxxO/PUei/6mfgSqVQMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)