UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8CNhBNzRVI6zsWZoTZ2gbWeeEQuwDX2FWNrepgC6VmQ=' 
WHERE 
  key_id = '504484e89df485fc28ea6781def6dfb84aa973a31502923f7d298e2f36aacccd' 
  AND (
    token = '8CNhBNzRVI6zsWZoTZ2gbWeeEQuwDX2FWNrepgC6VmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061