UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hciZHcqe6Z3XdfX4mAmlNxJgAhH4Wdz0C/Rp+STpL4Y=' 
WHERE 
  key_id = '5f98bdb68f4211217c01fb615473278cf39211ae779ae72715d232966339287a' 
  AND (
    token = 'hciZHcqe6Z3XdfX4mAmlNxJgAhH4Wdz0C/Rp+STpL4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023