UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fqKPjalv584r2NI5fLu1BFu6z3IOdbrxBkNPEYmxLCY='
WHERE
key_id = '40af0c6a3fc88c45c6b65d261abb75086b27f8ffee9556fe04a0bdccbc5ad835'
AND (
token = 'fqKPjalv584r2NI5fLu1BFu6z3IOdbrxBkNPEYmxLCY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)