UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2usyR14DsCM6tLlj+j4pvpEoxWK/UBHu8a9+8J87WdM=' 
WHERE 
  key_id = '7a63b4877bcaeefde40b5f18c13cacc5aa6fb18eae77d637a7dd71be5a22ca04' 
  AND (
    token = '2usyR14DsCM6tLlj+j4pvpEoxWK/UBHu8a9+8J87WdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037