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