UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FGUmmPE4qTpUYweUXpps5bW6ku231Ct7rvhTflD2Ugo=' 
WHERE 
  key_id = '5f0f9110f37bb45f8936741046ffc7aa3bd37acc2e2d15b4c3dc9e7666a80716' 
  AND (
    token = 'FGUmmPE4qTpUYweUXpps5bW6ku231Ct7rvhTflD2Ugo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020