UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wGmAO7g6NlFSXdH8dNcX+ysBepIFXYo2zbvzPfkY3Zc=' 
WHERE 
  key_id = '28e8a471bfef3eae67b52ebcd40a11ff5a98edc1b7f1bd4ec82a7e9c517a58c2' 
  AND (
    token = 'wGmAO7g6NlFSXdH8dNcX+ysBepIFXYo2zbvzPfkY3Zc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021