UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KgOKb7hdbgW5e3Ch8R07aIO4BuKSA2xuB96QveOcp/E='
WHERE
key_id = 'a0cd4b542dee349d05c88851327188a28ef1a4b6481c5e0804546c6c36df9278'
AND (
token = 'KgOKb7hdbgW5e3Ch8R07aIO4BuKSA2xuB96QveOcp/E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)