UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V0eFRTVus52xW9wRzc5DPjWLtqcY0vpkAi1XFFvfbLY=' 
WHERE 
  key_id = '5dbe6f48a58a74de1ce74e0fe60ea731bd360a069405c87ab85015da79b577ac' 
  AND (
    token = 'V0eFRTVus52xW9wRzc5DPjWLtqcY0vpkAi1XFFvfbLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032