UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fYud9EkzFG4zTMoRodpBNwWXj9AO6fV+bQB62RMfILw=' 
WHERE 
  key_id = '6a23b8de0166b0573df61766093f463917f7fc950d8e121d0b9c550220887095' 
  AND (
    token = 'fYud9EkzFG4zTMoRodpBNwWXj9AO6fV+bQB62RMfILw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038