UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aIp+z2fOJRWbbrq3g1R2JTrWX4WZFh04xI0MgJqmlfI=' 
WHERE 
  key_id = '71fe1018398e604c06c15ca3103616f48256fa15410977657afbcefdf44dfc13' 
  AND (
    token = 'aIp+z2fOJRWbbrq3g1R2JTrWX4WZFh04xI0MgJqmlfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037