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