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