UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PqEQ4wbKWY8wevSRwqRBB2jZm+K5uF1wxH9iEWPlXxQ='
WHERE
key_id = 'dd380e8dc9852921607bde680bac444c938c2aa5e65c64610ac2b69a06d51573'
AND (
token = 'PqEQ4wbKWY8wevSRwqRBB2jZm+K5uF1wxH9iEWPlXxQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)