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

Query time 0.00058