UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm1ggDSYa/bsM8elU4GzIEb58Gf9t9j2A2n5smJb22T8='
WHERE
key_id = 'e31cfabd6c6eccd88d1fe59beb7a7ecdfbfb8a8692a30c537dc330be96e10c46'
AND (
token = 'm1ggDSYa/bsM8elU4GzIEb58Gf9t9j2A2n5smJb22T8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)