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