UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a6UH2NmFrxb77GTehN5QAJ+YWcFIniGcp4bF22XZVQ8='
WHERE
key_id = '7543f8cdd5d235ac3d2295777bac0b52dd30a7c503d9a4c543e117b964bf2a99'
AND (
token = 'a6UH2NmFrxb77GTehN5QAJ+YWcFIniGcp4bF22XZVQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)