UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0cs2pvAaNz3f3cTg3b7FsgcciwK1Syf0kAufNHnZfEA=' 
WHERE 
  key_id = '3e5394dea5c34abd185b39e50d9deb818d5d4fd63d0bbcff844185113f407089' 
  AND (
    token = '0cs2pvAaNz3f3cTg3b7FsgcciwK1Syf0kAufNHnZfEA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039