UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oK5U0hGWXY8kvjdPOfUCNO+3h5QUab5mwQtPzRpu61g=' 
WHERE 
  key_id = '47d32a20943633c70d28fc3d996ff415bb3422c0f991db200cae0e0c1b46f369' 
  AND (
    token = 'oK5U0hGWXY8kvjdPOfUCNO+3h5QUab5mwQtPzRpu61g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037