UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'acsDem3YKtSC+G5PWT+labvhRP+VyL+YF0PabNahUnc=' 
WHERE 
  key_id = '6eea6a0538d040c6d55726017f007e7cc75a0739fdac0ab4bbfa7c575f814830' 
  AND (
    token = 'acsDem3YKtSC+G5PWT+labvhRP+VyL+YF0PabNahUnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016