UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O8a12rnaKozARDpRWIHQcFoW4n1ZhaKKq8Txqb6Pfdo='
WHERE
key_id = 'd19be22fa14380f351e7b61b95f8676a4b29dceaec4ca8a5d2b5b8663dbce527'
AND (
token = 'O8a12rnaKozARDpRWIHQcFoW4n1ZhaKKq8Txqb6Pfdo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)