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