UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lFgX7v9y8iELXfh1vZUc1NfrSCtpVh4LMDkZyjp3v6Y=' 
WHERE 
  key_id = '0db6a8da126a1772b3a8beb5a3ea47f3f35dee12305bc0877bee21430b6a3235' 
  AND (
    token = 'lFgX7v9y8iELXfh1vZUc1NfrSCtpVh4LMDkZyjp3v6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035